package com.inscream.app.profileTab;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.inscream.app.R;

public class EditMyProfile extends Activity {

    EditText nameSurname, cityInfo, aboutDescription, twitterUsername, facebookUsername, webPage, password, passwordAgain;
    Button saveMyProfile;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_my_profile);
        nameSurname = (EditText) findViewById(R.id.nameSurname);
        cityInfo = (EditText) findViewById(R.id.cityInfo);
        aboutDescription = (EditText) findViewById(R.id.aboutDescription);
        twitterUsername = (EditText) findViewById(R.id.twitterUsername);
        webPage = (EditText) findViewById(R.id.webPage);
        saveMyProfile = (Button) findViewById(R.id.saveMyProfile);
        saveMyProfile.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (password.getText().toString().matches("")) {
                    // Toast.makeText(getApplicationContext(), "You did not enter a password", Toast.LENGTH_SHORT).show();
                    runSaveProfile("");
                    nameSurname.setError("You did not enter a username");
                    return;
                } else if (!password.getText().toString().matches("") && !passwordAgain.getText().toString().matches("") && password.getText().toString() == passwordAgain.getText().toString()){
                    runSaveProfile(password.getText().toString());
                } else if(password.getText().toString() == passwordAgain.getText().toString()){

                }
            }
        });
    }

    public void runSaveProfile(String passChange){
        String newNameSurname = nameSurname.getText().toString();
        String newCityInfo = cityInfo.getText().toString();
        String newAboutDescription = aboutDescription.getText().toString();
        String newTwitterUsername = twitterUsername.getText().toString();
        String newWebPage = webPage.getText().toString();
        if(passChange.toString().matches("")) {
            // şifre doldurmuş değiştir<
            String newPassword = password.getText().toString();
        }
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.edit_my_profile, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
